package 剑指Offer._1120;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/7/7 21:23
 * 旋转数组的最小数字
 * 算法：二分查找
 */
public class _11 {

    public int minArray(int[] numbers) {
        int low = 0, high = numbers.length - 1;
        while (low < high) {
            int mid = low + (high - low) / 2;
            if (numbers[mid] > numbers[high]) low = mid + 1;
            else if (numbers[mid] < numbers[high]) high = mid;
            else --high; // 当数组存在重复的数
        }
        return numbers[low];
    }

}
